﻿using HRMSystem.Wpf.CompanyPages;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace HRMSystem.Wpf.DepartmentPages
{
    /// <summary>
    /// Interaction logic for addPage.xaml
    /// </summary>
    public partial class AddPage : Page
    {
        private static AddPage instance;
        public AddPage()
        {
            InitializeComponent();
        }
        public static AddPage Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new AddPage();
                }

                return instance;
            }
        }


        private void Save_Button_Click_1(object sender, RoutedEventArgs e)
        {
            DBServices.DepartmentService.insertDepartment(name.Text, comment.Text);

            ViewPage.NullInstance();
            DepartmentPage.Instance.ContentFrame.Content = ViewPage.Instance;
            AddPage.NullInstance();
        }
      

        private void Cancel_Button_Click_1(object sender, RoutedEventArgs e)
        {
           DepartmentPage.Instance.ContentFrame.Content = ViewPage.Instance;
        }

       
        private void ComboBox_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
        {

        }

        internal static void NullInstance()
        {
            instance = new AddPage();
        }

    }
}
